local wjsl_tazhen = fk.CreateSkill {
  name = "wjsl_tazhen",
  tags = { Skill.Compulsory, },
}

wjsl_tazhen:addEffect(fk.Damaged, {
  anim_type = "masochism",
  can_trigger = function(self, event, target, player, data)
    if not player:hasSkill(wjsl_tazhen.name) then return end
    return player == target and not player.dead and data.from and data.from~=player and data.damage > 1 and not data.from.dead
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local hands = data.from:getCardIds("h")
    if #hands > data.damage then
      local randcards = table.random(hands,data.damage)
      room:throwCard(randcards,wjsl_tazhen.name,data.from,player)
    else
      data.from:throwAllCards("he")
    end
    room:damage{
      from = player,
      to = data.from,
      damage = data.damage,
      skillName = wjsl_tazhen.name,
    }
  end,
})


return wjsl_tazhen